//
//  HAHomeViewController.m
//  HAFund
//
//  Created by 夏成龙 on 2018/10/30.
//  Copyright © 2018年 夏成龙. All rights reserved.
//

#import "HAHomeViewController.h"
#import "HANetworkManager.h"
#import <AudioToolbox/AudioToolbox.h>
#import "HAAPPEnviromentVC.h"

@interface HAHomeViewController ()

@end

@implementation HAHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [[UIApplication sharedApplication] setApplicationSupportsShakeToEdit:YES];
    [self becomeFirstResponder];
    
    [HANetworkManager GETWithPath:@"iap/portal/banner/TGSY" requestParams:@{@"aaaa":@"11111", @"bbbb":@"22222"} success:^(NSDictionary *response) {
        NSLog(@"%@", response);
    } failure:^(NSError *error) {
        NSLog(@"%@", error);
    }];
    
    
    
    [HANetworkManager POSTWithPath:@"iap/sys/getSysAds" requestParams:@{@"userId":@""} success:^(NSDictionary *response) {
        NSLog(@"%@", response);
    } failure:^(NSError *error) {
        NSLog(@"%@", error);
    }];
}

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    
}

- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    
}

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (event.subtype == UIEventSubtypeMotionShake) {
        AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
        HAAPPEnviromentVC *vc = [[HAAPPEnviromentVC alloc] init];
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
        [self presentViewController:nav animated:YES completion:nil];
    }
}

@end
